package com.example.demo.controller;

import com.example.demo.pojo.Response;
import com.example.demo.pojo.UserPoJo;
import com.example.demo.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author T480
 */
@RestController
@Slf4j
@Api(tags = "人员新增接口")
@RequestMapping(value = "/user")
public class UserController {
            @Autowired
            private UserService userService;


            @ApiOperation("人员登陆")
            @PostMapping(value = "/loging")
            public Response loging(@RequestBody UserPoJo userPoJo){

                Response response = userService.loging(userPoJo);
                return response;
         }


            @ApiOperation("人员注册及信息修改")
            @PostMapping(value = "/inserOrUpdate")
            public Response inserOrUpdateUser(@RequestBody UserPoJo userPoJo){

                Response response = userService.inserOrUpdateUser(userPoJo);
                return response;
            }

            @ApiOperation("人员删除")
            @PostMapping(value = "/deleteById")
            public Response deleteById(@RequestBody UserPoJo userPoJo){

                Response response = userService.deleteById(userPoJo);
                return response;
            }

            @ApiOperation("人员列表查询")
            @PostMapping(value = "/deleteById")
            public Response userListPage(@RequestBody UserPoJo userPoJo){

                Response response = userService.userListPage(userPoJo);
                return response;
            }
}
